package com.tegtech.starter.log.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 操作日志记录表 oper_log
 *
 * @author Jun
 */

@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("sys_oper_log")
public class SysOperLog implements Serializable {
	
	private static final long serialVersionUID = 1L;

	/**
	 * 日志主键
	 */
	@Excel(name = "操作序号", type = 10)
	@TableId(value = "oper_id", type = IdType.AUTO)
	private Long operId;

	/**
	 * 操作模块
	 */
	@Excel(name = "操作模块", width = 20)
	private String title;

	/**
	 *业务类型（其它_0, 新增_1, 修改_2, 删除_3, 授权_4, 导出_5, 导入_6, 强退_7, 生成代码_8, 空数据_9）
	 */
	@Excel(name = "业务类型", width = 15, replace = {"其它_0","新增_1","修改_2","删除_3","授权_4","导出_5","导入_6","强退_7","生成代码_8","清空数据_9"})
	private Integer businessType;

	/**
	 * 业务类型数组
	 */
	@TableField(exist = false)
	private Integer[] businessTypes;

	/**
	 * 请求方法
	 */
	@Excel(name = "请求方法", width = 20)
	private String method;

	/**
	 * 请求方式
	 */
	@Excel(name = "请求方式")
	private String requestMethod;

	/**
	 * 操作类别（0其它 1后台用户 2手机端用户）
	 */
	@Excel(name = "操作类别", replace = {"其它_0","后台用户_1","手机端用户_2"})
	private Integer operatorType;

	/**
	 * 操作人员
	 */
	@Excel(name = "操作人员", width = 15)
	private String operName;

	/**
	 * 部门名称
	 */
	@Excel(name = "部门名称", width = 15)
	private String deptName;

	/**
	 * 请求url
	 */
	@Excel(name = "请求地址", width = 20)
	private String operUrl;

	/**
	 * 操作地址
	 */
	@Excel(name = "操作地址", width = 15)
	private String operIp;

	/**
	 * 操作地点
	 */
	@Excel(name = "操作地点", width = 15)
	private String operLocation;

	/**
	 * 请求参数
	 */
	@Excel(name = "请求参数", width = 50)
	private String operParam;

	/**
	 * 返回参数
	 */
	@Excel(name = "返回参数", width = 50)
	private String jsonResult;

	/**
	 * 操作状态（0正常 1异常）
	 */
	@Excel(name = "状态", replace = {"正常_0","异常_1"})
	private Integer status;

	/**
	 * 错误消息
	 */
	@Excel(name = "错误消息", width = 30)
	private String errorMsg;

	/**
	 * 操作时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Excel(name = "操作时间", width = 30, format = "yyyy-MM-dd HH:mm:ss")
	private Date operTime;

	/**
	 * 请求参数
	 */
	@TableField(exist = false)
	private Map<String, Object> params = new HashMap<>();

}
